{% extends "base.html" %}

{% block content %}
<script type="text/javascript" src="/static/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/static/js/jquery-ui-1.8.16.custom.min.js"></script>
<link href="/static/css/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
<style type="text/css">@import url(/static/css/jquery-calendar.css);</style>
<script language="javascript" type="text/javascript">
$(document).ready(
	function()
	{
    
		var dc={{datecount}};
		if (dc>=4)
		{
	    $('#class_date3').datepicker({"dateFormat": "dd/mm/yy",changeMonth:true,changeYear:true})
	    $('#class_date4').datepicker({"dateFormat": "dd/mm/yy",changeMonth:true,changeYear:true})
		}
		if (dc==5)
		{
	    $('#class_date5').datepicker({"dateFormat": "dd/mm/yy",changeMonth:true,changeYear:true})
		}
	    $('#class_start').datepicker({"dateFormat": "dd/mm/yy",changeMonth:true,changeYear:true})
		$('#class_end').datepicker({"dateFormat": "dd/mm/yy",changeMonth:true,changeYear:true})
	}
);
 function setvalue()
 {
	var a=document.getElementById('v_forv').value; 
	document.getElementById('venue').value=a; 
 }
 </script>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
.saminput{
width:60px;
}
-->
</style>
 <style>
 .list-div {
  width: 96%;
  border: 1px solid #BBDDE5;
}
.list-div table {
  border: 1px solid #BBDDE5;
}
.list-div th {
  line-height: 24px;
  background: #BBDDE5 url("/static/images/th_bg.gif") repeat-x;
  white-space: nowrap;
}

.list-div td {
  line-height: 22px;
}
tr.over td {background:#F4FAFB; 
} 
</style>
<script language=javascript>
function verify(form){
  if(form.program_id.value==""){
 alert("Select program please");
 form.program_id.focus();  
       return false;
 }
return true;
 }
</script>
</head>

<body>

    <!-- tab bar -->

      <p>
		{%for p in p_list%}
		<span class="tab-back" id="mix-tab"><a href="/p_information/?pid={{p.id}}">{%if p_obj.id == p.id %}<font color='red'><b>{{p.name}}</b></font>{%else%}{{p.name}}{%endif%}</a></span>
		{%endfor%}
      </p>


<form name="saveinfo" method="post" onsubmit="return verify(this);">
<table width="100%" border="1" cellpadding="1" cellspacing="1" bordercolor="#64D5F0" bgcolor="#D1FAFE" class="aui-ibox-data aui-dotted-split">
  <tr>
    <td colspan="12">
	<select name="program_id" id="program_id">
	<option value="">Select Please</option>
	{%for p in p_list%}
	<option value="{{p.id}}" {%if p_obj.id == p.id %}selected{%endif%}>{{p.name}}</option>
	{%endfor%}
	</select>
    </td>
  </tr>
  <tr style="background:#0099ff;color:#ffffff;">
    <td WIDTH="80">Reference#</td>
    <td WIDTH="80">Modules</td>
	{%if isnotsdf%}
    <td WIDTH="80">Core/Elective</td>
    <td WIDTH="80">Course Code</td>
    <td WIDTH="80">Season</td>
	{%endif%}
    <td WIDTH="60">Year</td>
    <td WIDTH="120">Class Date</td>
    <td WIDTH="60">Lecturer</td>
    <td WIDTH="100">Textbook</td>
    <td WIDTH="80">Venue</td>
    <td>Attach Course Materials</td>
  </tr>
  <tr>
    <td><input type="text" name="period" id="period" value="{{pc_obj.period}}" style="width:50px;"/></td>
    <td>
		<textarea name="modules" id="modules" cols="10" rows="6">{{pc_obj.modules}}</textarea>
	</td>
		{%if isnotsdf%}
    <td>
	<select name="core_elective" id="core_elective">
	<option value="">Select</option>
	<option value="Core" {%if pc_obj.core_elective == 'Core'%}selected{%endif%}>Core</option>
	<option value="Elective" {%if pc_obj.core_elective == 'Elective'%}selected{%endif%}>Elective</option>
	</select>
	</td>
    <td><input type="text" name="coursecode" id="coursecode" value="{{pc_obj.coursecode}}" class="saminput" /></td>
    <td>
	<select name="season" id="season">
	<option value="">Select</option>
	<option value="Spring" {%if pc_obj.season == 'Spring'%}selected{%endif%}>Spring</option>
	<option value="Summer" {%if pc_obj.season == 'Summer'%}selected{%endif%}>Summer</option>
	<option value="Fall" {%if pc_obj.season == 'Fall'%}selected{%endif%}>Fall</option>
	</select>
	</td>
	{%else%}
	<input type="hidden" name="core_elective" id="core_elective" value="" />
	<input type="hidden" name="coursecode" id="coursecode" value="" />
	<input type="hidden" name="season" id="season" value="" />
	{%endif%}
    <td>
	<select name="year" id="year">
	<option value="2010" {%if pc_obj.year == '2010'%}selected{%endif%}>2010</option>
	<option value="2011" {%if pc_obj.year == '2011'%}selected{%endif%}>2011</option>
	<option value="2012" {%if pc_obj.year == '2012'%}selected{%endif%}>2012</option>
	<option value="2013" {%if pc_obj.year == '2013'%}selected{%endif%}>2013</option>
	<option value="2014" {%if pc_obj.year == '2014'%}selected{%endif%}>2014</option>
	<option value="2015" {%if pc_obj.year == '2015'%}selected{%endif%}>2015</option>
	</select>
	</td>
    <td>Day 1: <input type="text" name="class_start" id="class_start" value="{{pc_obj.class_start|date:'d/m/Y'}}"  /><br>
Day 2: <input type="text" name="class_end" id="class_end" value="{{pc_obj.class_end|date:'d/m/Y'}}"  />
	{%if datecount >= 4%}
	<br>Day 3: <input type="text" name="class_date3" id="class_date3" value="{{pc_obj.class_date3|date:'d/m/Y'}}"  />
	<br>Day 4: <input type="text" name="class_date4" id="class_date4" value="{{pc_obj.class_date4|date:'d/m/Y'}}"  />
	{%endif%}
	{%if datecount == 5%}
	<br>Day 5: <input type="text" name="class_date5" id="class_date5" value="{{pc_obj.class_date5|date:'d/m/Y'}}"  />
	{%endif%}
	</td>
    <td><input type="text" name="lecture" id="lecture" value="{{pc_obj.lecture}}" class="saminput" /></td>
    <td>
<textarea name="textbook" id="textbook" cols="15" rows="8">{{textbook}}</textarea>
	</td>
    <td>
	<select name="v_forv" id="v_forv" onchange="javascript:setvalue();" style="width:100px;">
	<option value="">Select</option>
	<option value="Regus (Wan Chai)" {%if pc_obj.v_forv == 'Regus (Wan Chai)'%}selected{%endif%}>Regus (Wan Chai)</option>
	<option value="Cliftons (Central)" {%if pc_obj.v_forv == 'Cliftons (Central)'%}selected{%endif%}>Cliftons (Central)</option>
	<option value="One Island East (Tai Koo)" {%if pc_obj.v_forv == 'One Island East (Tai Koo)'%}selected{%endif%}>One Island East (Tai Koo)</option>
	<option value="Infinitus Plaza (Sheung Wan)" {%if pc_obj.v_forv == 'Infinitus Plaza (Sheung Wan)'%}selected{%endif%}>Infinitus Plaza (Sheung Wan)</option>
	<option value="">Others</option>
	</select><br>
	<input type="text" name="venue" id="venue" value="{{pc_obj.venue}}" style="width:95px;" />
	</td>
    <td><input type="text" name="attoch" id="attoch" value="{{pc_obj.attoch}}" style="width:110px;"  /></td>
  </tr>  
  <tr>
    <td colspan="12"><input type="submit" name="gosave" value=" Save " />&nbsp;&nbsp;<input type="button" name="goback" value=" Back " onclick="history.go(-1)"/></td>
  </tr>
</table>
</form>
{% endblock %}
